﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using Indeco.G24.Entities;
using Indeco.G24.Data;

#endregion

namespace Indeco.G24.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="NguoiDungProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class NguoiDungProviderBaseCore : EntityProviderBase<Indeco.G24.Entities.NguoiDung, Indeco.G24.Entities.NguoiDungKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByIDVaiTroFromNguoiDungVaiTro
		
		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_VaiTro in the
		///		tb_NguoiDungVaiTro table. Table tb_NguoiDung is related to table tb_VaiTro
		///		through the (M:N) relationship defined in the tb_NguoiDungVaiTro table.
		/// </summary>
		/// <param name="iDVaiTro"></param>
		/// <returns>Returns a typed collection of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDVaiTroFromNguoiDungVaiTro(System.Guid iDVaiTro)
		{
			int count = -1;
			return GetByIDVaiTroFromNguoiDungVaiTro(null,iDVaiTro, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets Indeco.G24.Entities.NguoiDung objects from the datasource by ID_VaiTro in the
		///		tb_NguoiDungVaiTro table. Table tb_NguoiDung is related to table tb_VaiTro
		///		through the (M:N) relationship defined in the tb_NguoiDungVaiTro table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDVaiTro"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDVaiTroFromNguoiDungVaiTro(System.Guid iDVaiTro, int start, int pageLength)
		{
			int count = -1;
			return GetByIDVaiTroFromNguoiDungVaiTro(null, iDVaiTro, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_VaiTro in the
		///		tb_NguoiDungVaiTro table. Table tb_NguoiDung is related to table tb_VaiTro
		///		through the (M:N) relationship defined in the tb_NguoiDungVaiTro table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDVaiTro"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDVaiTroFromNguoiDungVaiTro(TransactionManager transactionManager, System.Guid iDVaiTro)
		{
			int count = -1;
			return GetByIDVaiTroFromNguoiDungVaiTro(transactionManager, iDVaiTro, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_VaiTro in the
		///		tb_NguoiDungVaiTro table. Table tb_NguoiDung is related to table tb_VaiTro
		///		through the (M:N) relationship defined in the tb_NguoiDungVaiTro table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDVaiTro"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDVaiTroFromNguoiDungVaiTro(TransactionManager transactionManager, System.Guid iDVaiTro,int start, int pageLength)
		{
			int count = -1;
			return GetByIDVaiTroFromNguoiDungVaiTro(transactionManager, iDVaiTro, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_VaiTro in the
		///		tb_NguoiDungVaiTro table. Table tb_NguoiDung is related to table tb_VaiTro
		///		through the (M:N) relationship defined in the tb_NguoiDungVaiTro table.
		/// </summary>
		/// <param name="iDVaiTro"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDVaiTroFromNguoiDungVaiTro(System.Guid iDVaiTro,int start, int pageLength, out int count)
		{
			
			return GetByIDVaiTroFromNguoiDungVaiTro(null, iDVaiTro, start, pageLength, out count);
		}


		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_VaiTro in the
		///		tb_NguoiDungVaiTro table. Table tb_NguoiDung is related to table tb_VaiTro
		///		through the (M:N) relationship defined in the tb_NguoiDungVaiTro table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="iDVaiTro"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public abstract TList<NguoiDung> GetByIDVaiTroFromNguoiDungVaiTro(TransactionManager transactionManager,System.Guid iDVaiTro, int start, int pageLength, out int count);
		
		#endregion GetByIDVaiTroFromNguoiDungVaiTro
		
		#region GetByIDDiaBanFromNguoiDungDiaBan
		
		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_DiaBan in the
		///		tb_NguoiDungDiaBan table. Table tb_NguoiDung is related to table tb_DiaBan
		///		through the (M:N) relationship defined in the tb_NguoiDungDiaBan table.
		/// </summary>
		/// <param name="iDDiaBan"></param>
		/// <returns>Returns a typed collection of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDDiaBanFromNguoiDungDiaBan(System.Guid iDDiaBan)
		{
			int count = -1;
			return GetByIDDiaBanFromNguoiDungDiaBan(null,iDDiaBan, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets Indeco.G24.Entities.NguoiDung objects from the datasource by ID_DiaBan in the
		///		tb_NguoiDungDiaBan table. Table tb_NguoiDung is related to table tb_DiaBan
		///		through the (M:N) relationship defined in the tb_NguoiDungDiaBan table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDDiaBan"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDDiaBanFromNguoiDungDiaBan(System.Guid iDDiaBan, int start, int pageLength)
		{
			int count = -1;
			return GetByIDDiaBanFromNguoiDungDiaBan(null, iDDiaBan, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_DiaBan in the
		///		tb_NguoiDungDiaBan table. Table tb_NguoiDung is related to table tb_DiaBan
		///		through the (M:N) relationship defined in the tb_NguoiDungDiaBan table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDDiaBan"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDDiaBanFromNguoiDungDiaBan(TransactionManager transactionManager, System.Guid iDDiaBan)
		{
			int count = -1;
			return GetByIDDiaBanFromNguoiDungDiaBan(transactionManager, iDDiaBan, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_DiaBan in the
		///		tb_NguoiDungDiaBan table. Table tb_NguoiDung is related to table tb_DiaBan
		///		through the (M:N) relationship defined in the tb_NguoiDungDiaBan table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDDiaBan"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDDiaBanFromNguoiDungDiaBan(TransactionManager transactionManager, System.Guid iDDiaBan,int start, int pageLength)
		{
			int count = -1;
			return GetByIDDiaBanFromNguoiDungDiaBan(transactionManager, iDDiaBan, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_DiaBan in the
		///		tb_NguoiDungDiaBan table. Table tb_NguoiDung is related to table tb_DiaBan
		///		through the (M:N) relationship defined in the tb_NguoiDungDiaBan table.
		/// </summary>
		/// <param name="iDDiaBan"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDDiaBanFromNguoiDungDiaBan(System.Guid iDDiaBan,int start, int pageLength, out int count)
		{
			
			return GetByIDDiaBanFromNguoiDungDiaBan(null, iDDiaBan, start, pageLength, out count);
		}


		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_DiaBan in the
		///		tb_NguoiDungDiaBan table. Table tb_NguoiDung is related to table tb_DiaBan
		///		through the (M:N) relationship defined in the tb_NguoiDungDiaBan table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="iDDiaBan"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public abstract TList<NguoiDung> GetByIDDiaBanFromNguoiDungDiaBan(TransactionManager transactionManager,System.Guid iDDiaBan, int start, int pageLength, out int count);
		
		#endregion GetByIDDiaBanFromNguoiDungDiaBan
		
		#region GetByIDNgheNghiepFromNguoiDungNgheNghiep
		
		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_NgheNghiep in the
		///		tb_NguoiDungNgheNghiep table. Table tb_NguoiDung is related to table tb_NgheNghiep
		///		through the (M:N) relationship defined in the tb_NguoiDungNgheNghiep table.
		/// </summary>
		/// <param name="iDNgheNghiep"></param>
		/// <returns>Returns a typed collection of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNgheNghiepFromNguoiDungNgheNghiep(System.Guid iDNgheNghiep)
		{
			int count = -1;
			return GetByIDNgheNghiepFromNguoiDungNgheNghiep(null,iDNgheNghiep, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets Indeco.G24.Entities.NguoiDung objects from the datasource by ID_NgheNghiep in the
		///		tb_NguoiDungNgheNghiep table. Table tb_NguoiDung is related to table tb_NgheNghiep
		///		through the (M:N) relationship defined in the tb_NguoiDungNgheNghiep table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDNgheNghiep"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNgheNghiepFromNguoiDungNgheNghiep(System.Guid iDNgheNghiep, int start, int pageLength)
		{
			int count = -1;
			return GetByIDNgheNghiepFromNguoiDungNgheNghiep(null, iDNgheNghiep, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_NgheNghiep in the
		///		tb_NguoiDungNgheNghiep table. Table tb_NguoiDung is related to table tb_NgheNghiep
		///		through the (M:N) relationship defined in the tb_NguoiDungNgheNghiep table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNgheNghiep"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNgheNghiepFromNguoiDungNgheNghiep(TransactionManager transactionManager, System.Guid iDNgheNghiep)
		{
			int count = -1;
			return GetByIDNgheNghiepFromNguoiDungNgheNghiep(transactionManager, iDNgheNghiep, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_NgheNghiep in the
		///		tb_NguoiDungNgheNghiep table. Table tb_NguoiDung is related to table tb_NgheNghiep
		///		through the (M:N) relationship defined in the tb_NguoiDungNgheNghiep table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNgheNghiep"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNgheNghiepFromNguoiDungNgheNghiep(TransactionManager transactionManager, System.Guid iDNgheNghiep,int start, int pageLength)
		{
			int count = -1;
			return GetByIDNgheNghiepFromNguoiDungNgheNghiep(transactionManager, iDNgheNghiep, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_NgheNghiep in the
		///		tb_NguoiDungNgheNghiep table. Table tb_NguoiDung is related to table tb_NgheNghiep
		///		through the (M:N) relationship defined in the tb_NguoiDungNgheNghiep table.
		/// </summary>
		/// <param name="iDNgheNghiep"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNgheNghiepFromNguoiDungNgheNghiep(System.Guid iDNgheNghiep,int start, int pageLength, out int count)
		{
			
			return GetByIDNgheNghiepFromNguoiDungNgheNghiep(null, iDNgheNghiep, start, pageLength, out count);
		}


		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_NgheNghiep in the
		///		tb_NguoiDungNgheNghiep table. Table tb_NguoiDung is related to table tb_NgheNghiep
		///		through the (M:N) relationship defined in the tb_NguoiDungNgheNghiep table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="iDNgheNghiep"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public abstract TList<NguoiDung> GetByIDNgheNghiepFromNguoiDungNgheNghiep(TransactionManager transactionManager,System.Guid iDNgheNghiep, int start, int pageLength, out int count);
		
		#endregion GetByIDNgheNghiepFromNguoiDungNgheNghiep
		
		#region GetByIDNhaCungCapFromNguoiDungNhaCungCap
		
		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_NhaCungCap in the
		///		tb_NguoiDungNhaCungCap table. Table tb_NguoiDung is related to table tb_NhaCungCap
		///		through the (M:N) relationship defined in the tb_NguoiDungNhaCungCap table.
		/// </summary>
		/// <param name="iDNhaCungCap"></param>
		/// <returns>Returns a typed collection of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNhaCungCapFromNguoiDungNhaCungCap(System.Guid iDNhaCungCap)
		{
			int count = -1;
			return GetByIDNhaCungCapFromNguoiDungNhaCungCap(null,iDNhaCungCap, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets Indeco.G24.Entities.NguoiDung objects from the datasource by ID_NhaCungCap in the
		///		tb_NguoiDungNhaCungCap table. Table tb_NguoiDung is related to table tb_NhaCungCap
		///		through the (M:N) relationship defined in the tb_NguoiDungNhaCungCap table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="iDNhaCungCap"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNhaCungCapFromNguoiDungNhaCungCap(System.Guid iDNhaCungCap, int start, int pageLength)
		{
			int count = -1;
			return GetByIDNhaCungCapFromNguoiDungNhaCungCap(null, iDNhaCungCap, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_NhaCungCap in the
		///		tb_NguoiDungNhaCungCap table. Table tb_NguoiDung is related to table tb_NhaCungCap
		///		through the (M:N) relationship defined in the tb_NguoiDungNhaCungCap table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNhaCungCap"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNhaCungCapFromNguoiDungNhaCungCap(TransactionManager transactionManager, System.Guid iDNhaCungCap)
		{
			int count = -1;
			return GetByIDNhaCungCapFromNguoiDungNhaCungCap(transactionManager, iDNhaCungCap, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_NhaCungCap in the
		///		tb_NguoiDungNhaCungCap table. Table tb_NguoiDung is related to table tb_NhaCungCap
		///		through the (M:N) relationship defined in the tb_NguoiDungNhaCungCap table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNhaCungCap"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNhaCungCapFromNguoiDungNhaCungCap(TransactionManager transactionManager, System.Guid iDNhaCungCap,int start, int pageLength)
		{
			int count = -1;
			return GetByIDNhaCungCapFromNguoiDungNhaCungCap(transactionManager, iDNhaCungCap, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets NguoiDung objects from the datasource by ID_NhaCungCap in the
		///		tb_NguoiDungNhaCungCap table. Table tb_NguoiDung is related to table tb_NhaCungCap
		///		through the (M:N) relationship defined in the tb_NguoiDungNhaCungCap table.
		/// </summary>
		/// <param name="iDNhaCungCap"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of tb_NguoiDung objects.</returns>
		public TList<NguoiDung> GetByIDNhaCungCapFromNguoiDungNhaCungCap(System.Guid iDNhaCungCap,int start, int pageLength, out int count)
		{
			
			return GetByIDNhaCungCapFromNguoiDungNhaCungCap(null, iDNhaCungCap, start, pageLength, out count);
		}


		/// <summary>
		///		Gets tb_NguoiDung objects from the datasource by ID_NhaCungCap in the
		///		tb_NguoiDungNhaCungCap table. Table tb_NguoiDung is related to table tb_NhaCungCap
		///		through the (M:N) relationship defined in the tb_NguoiDungNhaCungCap table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="iDNhaCungCap"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of NguoiDung objects.</returns>
		public abstract TList<NguoiDung> GetByIDNhaCungCapFromNguoiDungNhaCungCap(TransactionManager transactionManager,System.Guid iDNhaCungCap, int start, int pageLength, out int count);
		
		#endregion GetByIDNhaCungCapFromNguoiDungNhaCungCap
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, Indeco.G24.Entities.NguoiDungKey key)
		{
			return Delete(transactionManager, key.IDNguoiDung);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="iDNguoiDung">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Guid iDNguoiDung)
		{
			return Delete(null, iDNguoiDung);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNguoiDung">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Guid iDNguoiDung);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override Indeco.G24.Entities.NguoiDung Get(TransactionManager transactionManager, Indeco.G24.Entities.NguoiDungKey key, int start, int pageLength)
		{
			return GetByIDNguoiDung(transactionManager, key.IDNguoiDung, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_tb_NguoiDung index.
		/// </summary>
		/// <param name="iDNguoiDung"></param>
		/// <returns>Returns an instance of the <see cref="Indeco.G24.Entities.NguoiDung"/> class.</returns>
		public Indeco.G24.Entities.NguoiDung GetByIDNguoiDung(System.Guid iDNguoiDung)
		{
			int count = -1;
			return GetByIDNguoiDung(null,iDNguoiDung, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tb_NguoiDung index.
		/// </summary>
		/// <param name="iDNguoiDung"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="Indeco.G24.Entities.NguoiDung"/> class.</returns>
		public Indeco.G24.Entities.NguoiDung GetByIDNguoiDung(System.Guid iDNguoiDung, int start, int pageLength)
		{
			int count = -1;
			return GetByIDNguoiDung(null, iDNguoiDung, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tb_NguoiDung index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNguoiDung"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="Indeco.G24.Entities.NguoiDung"/> class.</returns>
		public Indeco.G24.Entities.NguoiDung GetByIDNguoiDung(TransactionManager transactionManager, System.Guid iDNguoiDung)
		{
			int count = -1;
			return GetByIDNguoiDung(transactionManager, iDNguoiDung, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tb_NguoiDung index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNguoiDung"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="Indeco.G24.Entities.NguoiDung"/> class.</returns>
		public Indeco.G24.Entities.NguoiDung GetByIDNguoiDung(TransactionManager transactionManager, System.Guid iDNguoiDung, int start, int pageLength)
		{
			int count = -1;
			return GetByIDNguoiDung(transactionManager, iDNguoiDung, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tb_NguoiDung index.
		/// </summary>
		/// <param name="iDNguoiDung"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="Indeco.G24.Entities.NguoiDung"/> class.</returns>
		public Indeco.G24.Entities.NguoiDung GetByIDNguoiDung(System.Guid iDNguoiDung, int start, int pageLength, out int count)
		{
			return GetByIDNguoiDung(null, iDNguoiDung, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_tb_NguoiDung index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="iDNguoiDung"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="Indeco.G24.Entities.NguoiDung"/> class.</returns>
		public abstract Indeco.G24.Entities.NguoiDung GetByIDNguoiDung(TransactionManager transactionManager, System.Guid iDNguoiDung, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a Indeco.G24.Entities.TList&lt;NguoiDung&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="Indeco.G24.Entities.TList&lt;NguoiDung&gt;"/></returns>
		public static Indeco.G24.Entities.TList<NguoiDung> Fill(IDataReader reader, Indeco.G24.Entities.TList<NguoiDung> rows, int start, int pageLength)
		{
		// advance to the starting row
		for (int i = 0; i < start; i++)
		{
			if (!reader.Read())
			return rows; // not enough rows, just return
		}
		for (int i = 0; i < pageLength; i++)
		{
			if (!reader.Read())
			break; // we are done
			string key = null;
			
			Indeco.G24.Entities.NguoiDung c = null;
			if (DataRepository.Provider.UseEntityFactory)
			{
			key = new System.Text.StringBuilder("NguoiDung")
			.Append("|").Append((reader.IsDBNull(((int)Indeco.G24.Entities.NguoiDungColumn.IDNguoiDung - 1))?Guid.NewGuid():(System.Guid)reader[((int)Indeco.G24.Entities.NguoiDungColumn.IDNguoiDung - 1)]).ToString()).ToString();
			c = EntityManager.LocateOrCreate<NguoiDung>(
			key.ToString(), // EntityTrackingKey
			"NguoiDung",  //Creational Type
			DataRepository.Provider.EntityCreationalFactoryType,  //Factory used to create entity
			DataRepository.Provider.EnableEntityTracking); // Track this entity?
			}
			else
			{
			c = new Indeco.G24.Entities.NguoiDung();
			}
			
			if (!DataRepository.Provider.EnableEntityTracking ||
			c.EntityState == EntityState.Added ||
			(DataRepository.Provider.EnableEntityTracking &&
			((DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
			(DataRepository.Provider.CurrentLoadPolicy == LoadPolicy.DiscardChanges && (c.EntityState == EntityState.Unchanged ||
								c.EntityState == EntityState.Changed)))))
						{
			c.SuppressEntityEvents = true;
			c.IDNguoiDung = (System.Guid)reader["ID_NguoiDung"];
			c.OriginalIDNguoiDung = c.IDNguoiDung;
			c.TenSuDung = (System.String)reader["TenSuDung"];
			c.MatKhau = (System.String)reader["MatKhau"];
			c.ChungThuc = (System.Boolean)reader["ChungThuc"];
			c.MaKichHoat = reader.IsDBNull(reader.GetOrdinal("MaKichHoat")) ? null : (System.String)reader["MaKichHoat"];
			c.KichHoat = (System.Boolean)reader["KichHoat"];
			c.CamHoatDong = (System.Boolean)reader["CamHoatDong"];
			c.Xoa = (System.Boolean)reader["Xoa"];
			c.Ten = reader.IsDBNull(reader.GetOrdinal("Ten")) ? null : (System.String)reader["Ten"];
			c.Ho = reader.IsDBNull(reader.GetOrdinal("Ho")) ? null : (System.String)reader["Ho"];
			c.Email = (System.String)reader["Email"];
			c.NgaySinh = reader.IsDBNull(reader.GetOrdinal("NgaySinh")) ? null : (System.DateTime?)reader["NgaySinh"];
			c.DiaChi = reader.IsDBNull(reader.GetOrdinal("DiaChi")) ? null : (System.String)reader["DiaChi"];
			c.MoTa = reader.IsDBNull(reader.GetOrdinal("MoTa")) ? null : (System.String)reader["MoTa"];
			c.HinhMinhHoa = reader.IsDBNull(reader.GetOrdinal("HinhMinhHoa")) ? null : (System.String)reader["HinhMinhHoa"];
			c.DienThoai = reader.IsDBNull(reader.GetOrdinal("DienThoai")) ? null : (System.String)reader["DienThoai"];
			c.Mobile = reader.IsDBNull(reader.GetOrdinal("Mobile")) ? null : (System.String)reader["Mobile"];
			c.MSN = reader.IsDBNull(reader.GetOrdinal("MSN")) ? null : (System.String)reader["MSN"];
			c.Yahoo = reader.IsDBNull(reader.GetOrdinal("Yahoo")) ? null : (System.String)reader["Yahoo"];
			c.Skype = reader.IsDBNull(reader.GetOrdinal("Skype")) ? null : (System.String)reader["Skype"];
			c.IP = reader.IsDBNull(reader.GetOrdinal("IP")) ? null : (System.String)reader["IP"];
			c.ThoiDiemTruyCap = (System.DateTime)reader["ThoiDiemTruyCap"];
			c.ThoiDiemThoat = (System.DateTime)reader["ThoiDiemThoat"];
			c.ThoiDiemCapNhat = (System.DateTime)reader["ThoiDiemCapNhat"];
			c.ThoiDiemChinhSua = (System.DateTime)reader["ThoiDiemChinhSua"];
			c.EntityTrackingKey = key;
			c.AcceptChanges();
			c.SuppressEntityEvents = false;
			}
			rows.Add(c);
		}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="Indeco.G24.Entities.NguoiDung"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="Indeco.G24.Entities.NguoiDung"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, Indeco.G24.Entities.NguoiDung entity)
		{
			if (!reader.Read()) return;
			
			entity.IDNguoiDung = (System.Guid)reader["ID_NguoiDung"];
			entity.OriginalIDNguoiDung = (System.Guid)reader["ID_NguoiDung"];
			entity.TenSuDung = (System.String)reader["TenSuDung"];
			entity.MatKhau = (System.String)reader["MatKhau"];
			entity.ChungThuc = (System.Boolean)reader["ChungThuc"];
			entity.MaKichHoat = reader.IsDBNull(reader.GetOrdinal("MaKichHoat")) ? null : (System.String)reader["MaKichHoat"];
			entity.KichHoat = (System.Boolean)reader["KichHoat"];
			entity.CamHoatDong = (System.Boolean)reader["CamHoatDong"];
			entity.Xoa = (System.Boolean)reader["Xoa"];
			entity.Ten = reader.IsDBNull(reader.GetOrdinal("Ten")) ? null : (System.String)reader["Ten"];
			entity.Ho = reader.IsDBNull(reader.GetOrdinal("Ho")) ? null : (System.String)reader["Ho"];
			entity.Email = (System.String)reader["Email"];
			entity.NgaySinh = reader.IsDBNull(reader.GetOrdinal("NgaySinh")) ? null : (System.DateTime?)reader["NgaySinh"];
			entity.DiaChi = reader.IsDBNull(reader.GetOrdinal("DiaChi")) ? null : (System.String)reader["DiaChi"];
			entity.MoTa = reader.IsDBNull(reader.GetOrdinal("MoTa")) ? null : (System.String)reader["MoTa"];
			entity.HinhMinhHoa = reader.IsDBNull(reader.GetOrdinal("HinhMinhHoa")) ? null : (System.String)reader["HinhMinhHoa"];
			entity.DienThoai = reader.IsDBNull(reader.GetOrdinal("DienThoai")) ? null : (System.String)reader["DienThoai"];
			entity.Mobile = reader.IsDBNull(reader.GetOrdinal("Mobile")) ? null : (System.String)reader["Mobile"];
			entity.MSN = reader.IsDBNull(reader.GetOrdinal("MSN")) ? null : (System.String)reader["MSN"];
			entity.Yahoo = reader.IsDBNull(reader.GetOrdinal("Yahoo")) ? null : (System.String)reader["Yahoo"];
			entity.Skype = reader.IsDBNull(reader.GetOrdinal("Skype")) ? null : (System.String)reader["Skype"];
			entity.IP = reader.IsDBNull(reader.GetOrdinal("IP")) ? null : (System.String)reader["IP"];
			entity.ThoiDiemTruyCap = (System.DateTime)reader["ThoiDiemTruyCap"];
			entity.ThoiDiemThoat = (System.DateTime)reader["ThoiDiemThoat"];
			entity.ThoiDiemCapNhat = (System.DateTime)reader["ThoiDiemCapNhat"];
			entity.ThoiDiemChinhSua = (System.DateTime)reader["ThoiDiemChinhSua"];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="Indeco.G24.Entities.NguoiDung"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="Indeco.G24.Entities.NguoiDung"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, Indeco.G24.Entities.NguoiDung entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IDNguoiDung = (System.Guid)dataRow["ID_NguoiDung"];
			entity.OriginalIDNguoiDung = (System.Guid)dataRow["ID_NguoiDung"];
			entity.TenSuDung = (System.String)dataRow["TenSuDung"];
			entity.MatKhau = (System.String)dataRow["MatKhau"];
			entity.ChungThuc = (System.Boolean)dataRow["ChungThuc"];
			entity.MaKichHoat = Convert.IsDBNull(dataRow["MaKichHoat"]) ? null : (System.String)dataRow["MaKichHoat"];
			entity.KichHoat = (System.Boolean)dataRow["KichHoat"];
			entity.CamHoatDong = (System.Boolean)dataRow["CamHoatDong"];
			entity.Xoa = (System.Boolean)dataRow["Xoa"];
			entity.Ten = Convert.IsDBNull(dataRow["Ten"]) ? null : (System.String)dataRow["Ten"];
			entity.Ho = Convert.IsDBNull(dataRow["Ho"]) ? null : (System.String)dataRow["Ho"];
			entity.Email = (System.String)dataRow["Email"];
			entity.NgaySinh = Convert.IsDBNull(dataRow["NgaySinh"]) ? null : (System.DateTime?)dataRow["NgaySinh"];
			entity.DiaChi = Convert.IsDBNull(dataRow["DiaChi"]) ? null : (System.String)dataRow["DiaChi"];
			entity.MoTa = Convert.IsDBNull(dataRow["MoTa"]) ? null : (System.String)dataRow["MoTa"];
			entity.HinhMinhHoa = Convert.IsDBNull(dataRow["HinhMinhHoa"]) ? null : (System.String)dataRow["HinhMinhHoa"];
			entity.DienThoai = Convert.IsDBNull(dataRow["DienThoai"]) ? null : (System.String)dataRow["DienThoai"];
			entity.Mobile = Convert.IsDBNull(dataRow["Mobile"]) ? null : (System.String)dataRow["Mobile"];
			entity.MSN = Convert.IsDBNull(dataRow["MSN"]) ? null : (System.String)dataRow["MSN"];
			entity.Yahoo = Convert.IsDBNull(dataRow["Yahoo"]) ? null : (System.String)dataRow["Yahoo"];
			entity.Skype = Convert.IsDBNull(dataRow["Skype"]) ? null : (System.String)dataRow["Skype"];
			entity.IP = Convert.IsDBNull(dataRow["IP"]) ? null : (System.String)dataRow["IP"];
			entity.ThoiDiemTruyCap = (System.DateTime)dataRow["ThoiDiemTruyCap"];
			entity.ThoiDiemThoat = (System.DateTime)dataRow["ThoiDiemThoat"];
			entity.ThoiDiemCapNhat = (System.DateTime)dataRow["ThoiDiemCapNhat"];
			entity.ThoiDiemChinhSua = (System.DateTime)dataRow["ThoiDiemChinhSua"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="Indeco.G24.Entities.NguoiDung"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">Indeco.G24.Entities.NguoiDung Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		internal override void DeepLoad(TransactionManager transactionManager, Indeco.G24.Entities.NguoiDung entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByIDNguoiDung methods when available
			
			#region DiaBanCollection_From_NguoiDungDiaBan
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<DiaBan>|DiaBanCollection_From_NguoiDungDiaBan", deepLoadType, innerList))
			{
				entity.DiaBanCollection_From_NguoiDungDiaBan = DataRepository.DiaBanProvider.GetByIDNguoiDungFromNguoiDungDiaBan(transactionManager, entity.IDNguoiDung);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DiaBanCollection_From_NguoiDungDiaBan' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.DiaBanCollection_From_NguoiDungDiaBan != null)
				{
					deepHandles.Add("DiaBanCollection_From_NguoiDungDiaBan",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< DiaBan >) DataRepository.DiaBanProvider.DeepLoad,
						new object[] { transactionManager, entity.DiaBanCollection_From_NguoiDungDiaBan, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region NgheNghiepCollection_From_NguoiDungNgheNghiep
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<NgheNghiep>|NgheNghiepCollection_From_NguoiDungNgheNghiep", deepLoadType, innerList))
			{
				entity.NgheNghiepCollection_From_NguoiDungNgheNghiep = DataRepository.NgheNghiepProvider.GetByIDNguoiDungFromNguoiDungNgheNghiep(transactionManager, entity.IDNguoiDung);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NgheNghiepCollection_From_NguoiDungNgheNghiep' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.NgheNghiepCollection_From_NguoiDungNgheNghiep != null)
				{
					deepHandles.Add("NgheNghiepCollection_From_NguoiDungNgheNghiep",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< NgheNghiep >) DataRepository.NgheNghiepProvider.DeepLoad,
						new object[] { transactionManager, entity.NgheNghiepCollection_From_NguoiDungNgheNghiep, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region NguoiDungVaiTroCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<NguoiDungVaiTro>|NguoiDungVaiTroCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NguoiDungVaiTroCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.NguoiDungVaiTroCollection = DataRepository.NguoiDungVaiTroProvider.GetByIDNguoiDung(transactionManager, entity.IDNguoiDung);

				if (deep && entity.NguoiDungVaiTroCollection.Count > 0)
				{
					deepHandles.Add("NguoiDungVaiTroCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<NguoiDungVaiTro>) DataRepository.NguoiDungVaiTroProvider.DeepLoad,
						new object[] { transactionManager, entity.NguoiDungVaiTroCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region NguoiDungDiaBanCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<NguoiDungDiaBan>|NguoiDungDiaBanCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NguoiDungDiaBanCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.NguoiDungDiaBanCollection = DataRepository.NguoiDungDiaBanProvider.GetByIDNguoiDung(transactionManager, entity.IDNguoiDung);

				if (deep && entity.NguoiDungDiaBanCollection.Count > 0)
				{
					deepHandles.Add("NguoiDungDiaBanCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<NguoiDungDiaBan>) DataRepository.NguoiDungDiaBanProvider.DeepLoad,
						new object[] { transactionManager, entity.NguoiDungDiaBanCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region NguoiDungNhaCungCapCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<NguoiDungNhaCungCap>|NguoiDungNhaCungCapCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NguoiDungNhaCungCapCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.NguoiDungNhaCungCapCollection = DataRepository.NguoiDungNhaCungCapProvider.GetByIDNguoiDung(transactionManager, entity.IDNguoiDung);

				if (deep && entity.NguoiDungNhaCungCapCollection.Count > 0)
				{
					deepHandles.Add("NguoiDungNhaCungCapCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<NguoiDungNhaCungCap>) DataRepository.NguoiDungNhaCungCapProvider.DeepLoad,
						new object[] { transactionManager, entity.NguoiDungNhaCungCapCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region QuanLyFileCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<QuanLyFile>|QuanLyFileCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'QuanLyFileCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.QuanLyFileCollection = DataRepository.QuanLyFileProvider.GetByIDNguoiDung(transactionManager, entity.IDNguoiDung);

				if (deep && entity.QuanLyFileCollection.Count > 0)
				{
					deepHandles.Add("QuanLyFileCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<QuanLyFile>) DataRepository.QuanLyFileProvider.DeepLoad,
						new object[] { transactionManager, entity.QuanLyFileCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region NguoiDungNgheNghiepCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<NguoiDungNgheNghiep>|NguoiDungNgheNghiepCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NguoiDungNgheNghiepCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.NguoiDungNgheNghiepCollection = DataRepository.NguoiDungNgheNghiepProvider.GetByIDNguoiDung(transactionManager, entity.IDNguoiDung);

				if (deep && entity.NguoiDungNgheNghiepCollection.Count > 0)
				{
					deepHandles.Add("NguoiDungNgheNghiepCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<NguoiDungNgheNghiep>) DataRepository.NguoiDungNgheNghiepProvider.DeepLoad,
						new object[] { transactionManager, entity.NguoiDungNgheNghiepCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region VaiTroCollection_From_NguoiDungVaiTro
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<VaiTro>|VaiTroCollection_From_NguoiDungVaiTro", deepLoadType, innerList))
			{
				entity.VaiTroCollection_From_NguoiDungVaiTro = DataRepository.VaiTroProvider.GetByIDNguoiDungFromNguoiDungVaiTro(transactionManager, entity.IDNguoiDung);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'VaiTroCollection_From_NguoiDungVaiTro' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.VaiTroCollection_From_NguoiDungVaiTro != null)
				{
					deepHandles.Add("VaiTroCollection_From_NguoiDungVaiTro",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< VaiTro >) DataRepository.VaiTroProvider.DeepLoad,
						new object[] { transactionManager, entity.VaiTroCollection_From_NguoiDungVaiTro, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region NhaCungCapCollection_From_NguoiDungNhaCungCap
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<NhaCungCap>|NhaCungCapCollection_From_NguoiDungNhaCungCap", deepLoadType, innerList))
			{
				entity.NhaCungCapCollection_From_NguoiDungNhaCungCap = DataRepository.NhaCungCapProvider.GetByIDNguoiDungFromNguoiDungNhaCungCap(transactionManager, entity.IDNguoiDung);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NhaCungCapCollection_From_NguoiDungNhaCungCap' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.NhaCungCapCollection_From_NguoiDungNhaCungCap != null)
				{
					deepHandles.Add("NhaCungCapCollection_From_NguoiDungNhaCungCap",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< NhaCungCap >) DataRepository.NhaCungCapProvider.DeepLoad,
						new object[] { transactionManager, entity.NhaCungCapCollection_From_NguoiDungNhaCungCap, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the Indeco.G24.Entities.NguoiDung object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">Indeco.G24.Entities.NguoiDung instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">Indeco.G24.Entities.NguoiDung Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		internal override bool DeepSave(TransactionManager transactionManager, Indeco.G24.Entities.NguoiDung entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<Delegate, object> deepHandles = new Dictionary<Delegate, object>();

			#region DiaBanCollection_From_NguoiDungDiaBan>
			if (CanDeepSave(entity.DiaBanCollection_From_NguoiDungDiaBan, "List<DiaBan>|DiaBanCollection_From_NguoiDungDiaBan", deepSaveType, innerList))
			{
				if (entity.DiaBanCollection_From_NguoiDungDiaBan.Count > 0 || entity.DiaBanCollection_From_NguoiDungDiaBan.DeletedItems.Count > 0)
				{
					DataRepository.DiaBanProvider.Save(transactionManager, entity.DiaBanCollection_From_NguoiDungDiaBan); 
					deepHandles.Add(
						(DeepSaveHandle<DiaBan>) DataRepository.DiaBanProvider.DeepSave,
						new object[] { transactionManager, entity.DiaBanCollection_From_NguoiDungDiaBan, deepSaveType, childTypes, innerList }
					);
				}
			}
			#endregion 

			#region NgheNghiepCollection_From_NguoiDungNgheNghiep>
			if (CanDeepSave(entity.NgheNghiepCollection_From_NguoiDungNgheNghiep, "List<NgheNghiep>|NgheNghiepCollection_From_NguoiDungNgheNghiep", deepSaveType, innerList))
			{
				if (entity.NgheNghiepCollection_From_NguoiDungNgheNghiep.Count > 0 || entity.NgheNghiepCollection_From_NguoiDungNgheNghiep.DeletedItems.Count > 0)
				{
					DataRepository.NgheNghiepProvider.Save(transactionManager, entity.NgheNghiepCollection_From_NguoiDungNgheNghiep); 
					deepHandles.Add(
						(DeepSaveHandle<NgheNghiep>) DataRepository.NgheNghiepProvider.DeepSave,
						new object[] { transactionManager, entity.NgheNghiepCollection_From_NguoiDungNgheNghiep, deepSaveType, childTypes, innerList }
					);
				}
			}
			#endregion 

			#region VaiTroCollection_From_NguoiDungVaiTro>
			if (CanDeepSave(entity.VaiTroCollection_From_NguoiDungVaiTro, "List<VaiTro>|VaiTroCollection_From_NguoiDungVaiTro", deepSaveType, innerList))
			{
				if (entity.VaiTroCollection_From_NguoiDungVaiTro.Count > 0 || entity.VaiTroCollection_From_NguoiDungVaiTro.DeletedItems.Count > 0)
				{
					DataRepository.VaiTroProvider.Save(transactionManager, entity.VaiTroCollection_From_NguoiDungVaiTro); 
					deepHandles.Add(
						(DeepSaveHandle<VaiTro>) DataRepository.VaiTroProvider.DeepSave,
						new object[] { transactionManager, entity.VaiTroCollection_From_NguoiDungVaiTro, deepSaveType, childTypes, innerList }
					);
				}
			}
			#endregion 

			#region NhaCungCapCollection_From_NguoiDungNhaCungCap>
			if (CanDeepSave(entity.NhaCungCapCollection_From_NguoiDungNhaCungCap, "List<NhaCungCap>|NhaCungCapCollection_From_NguoiDungNhaCungCap", deepSaveType, innerList))
			{
				if (entity.NhaCungCapCollection_From_NguoiDungNhaCungCap.Count > 0 || entity.NhaCungCapCollection_From_NguoiDungNhaCungCap.DeletedItems.Count > 0)
				{
					DataRepository.NhaCungCapProvider.Save(transactionManager, entity.NhaCungCapCollection_From_NguoiDungNhaCungCap); 
					deepHandles.Add(
						(DeepSaveHandle<NhaCungCap>) DataRepository.NhaCungCapProvider.DeepSave,
						new object[] { transactionManager, entity.NhaCungCapCollection_From_NguoiDungNhaCungCap, deepSaveType, childTypes, innerList }
					);
				}
			}
			#endregion 
	
			#region List<NguoiDungVaiTro>
				if (CanDeepSave(entity.NguoiDungVaiTroCollection, "List<NguoiDungVaiTro>|NguoiDungVaiTroCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(NguoiDungVaiTro child in entity.NguoiDungVaiTroCollection)
					{
						if(child.IDNguoiDungSource != null)
							child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;
						else
							child.IDNguoiDung = entity.IDNguoiDung;

						//Handle right table of VaiTroCollection_From_NguoiDungVaiTro
						if(child.IDVaiTroSource != null)
						{
								child.IDVaiTro = child.IDVaiTroSource.IDVaiTro;

						}

						//Handle right table of VaiTroCollection_From_NguoiDungVaiTro
						if(child.IDNguoiDungSource != null)
						{
								child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;

						}

					}

					if (entity.NguoiDungVaiTroCollection.Count > 0 || entity.NguoiDungVaiTroCollection.DeletedItems.Count > 0)
					{
						DataRepository.NguoiDungVaiTroProvider.Save(transactionManager, entity.NguoiDungVaiTroCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< NguoiDungVaiTro >) DataRepository.NguoiDungVaiTroProvider.DeepSave,
							new object[] { transactionManager, entity.NguoiDungVaiTroCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<NguoiDungDiaBan>
				if (CanDeepSave(entity.NguoiDungDiaBanCollection, "List<NguoiDungDiaBan>|NguoiDungDiaBanCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(NguoiDungDiaBan child in entity.NguoiDungDiaBanCollection)
					{
						if(child.IDNguoiDungSource != null)
							child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;
						else
							child.IDNguoiDung = entity.IDNguoiDung;

						//Handle right table of DiaBanCollection_From_NguoiDungDiaBan
						if(child.IDDiaBanSource != null)
						{
								child.IDDiaBan = child.IDDiaBanSource.IDDiaBan;

						}

						//Handle right table of DiaBanCollection_From_NguoiDungDiaBan
						if(child.IDNguoiDungSource != null)
						{
								child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;

						}

					}

					if (entity.NguoiDungDiaBanCollection.Count > 0 || entity.NguoiDungDiaBanCollection.DeletedItems.Count > 0)
					{
						DataRepository.NguoiDungDiaBanProvider.Save(transactionManager, entity.NguoiDungDiaBanCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< NguoiDungDiaBan >) DataRepository.NguoiDungDiaBanProvider.DeepSave,
							new object[] { transactionManager, entity.NguoiDungDiaBanCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<NguoiDungNhaCungCap>
				if (CanDeepSave(entity.NguoiDungNhaCungCapCollection, "List<NguoiDungNhaCungCap>|NguoiDungNhaCungCapCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(NguoiDungNhaCungCap child in entity.NguoiDungNhaCungCapCollection)
					{
						if(child.IDNguoiDungSource != null)
							child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;
						else
							child.IDNguoiDung = entity.IDNguoiDung;

						//Handle right table of NhaCungCapCollection_From_NguoiDungNhaCungCap
						if(child.IDNguoiDungSource != null)
						{
								child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;

						}

						//Handle right table of NhaCungCapCollection_From_NguoiDungNhaCungCap
						if(child.IDNhaCungCapSource != null)
						{
								child.IDNhaCungCap = child.IDNhaCungCapSource.IDNhaCungCap;

						}

					}

					if (entity.NguoiDungNhaCungCapCollection.Count > 0 || entity.NguoiDungNhaCungCapCollection.DeletedItems.Count > 0)
					{
						DataRepository.NguoiDungNhaCungCapProvider.Save(transactionManager, entity.NguoiDungNhaCungCapCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< NguoiDungNhaCungCap >) DataRepository.NguoiDungNhaCungCapProvider.DeepSave,
							new object[] { transactionManager, entity.NguoiDungNhaCungCapCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<QuanLyFile>
				if (CanDeepSave(entity.QuanLyFileCollection, "List<QuanLyFile>|QuanLyFileCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(QuanLyFile child in entity.QuanLyFileCollection)
					{
						if(child.IDNguoiDungSource != null)
							child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;
						else
							child.IDNguoiDung = entity.IDNguoiDung;

					}

					if (entity.QuanLyFileCollection.Count > 0 || entity.QuanLyFileCollection.DeletedItems.Count > 0)
					{
						DataRepository.QuanLyFileProvider.Save(transactionManager, entity.QuanLyFileCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< QuanLyFile >) DataRepository.QuanLyFileProvider.DeepSave,
							new object[] { transactionManager, entity.QuanLyFileCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
	
			#region List<NguoiDungNgheNghiep>
				if (CanDeepSave(entity.NguoiDungNgheNghiepCollection, "List<NguoiDungNgheNghiep>|NguoiDungNgheNghiepCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(NguoiDungNgheNghiep child in entity.NguoiDungNgheNghiepCollection)
					{
						if(child.IDNguoiDungSource != null)
							child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;
						else
							child.IDNguoiDung = entity.IDNguoiDung;

						//Handle right table of NgheNghiepCollection_From_NguoiDungNgheNghiep
						if(child.IDNguoiDungSource != null)
						{
								child.IDNguoiDung = child.IDNguoiDungSource.IDNguoiDung;

						}

						//Handle right table of NgheNghiepCollection_From_NguoiDungNgheNghiep
						if(child.IDNgheNghiepSource != null)
						{
								child.IDNgheNghiep = child.IDNgheNghiepSource.IDNgheNghiep;

						}

					}

					if (entity.NguoiDungNgheNghiepCollection.Count > 0 || entity.NguoiDungNgheNghiepCollection.DeletedItems.Count > 0)
					{
						DataRepository.NguoiDungNgheNghiepProvider.Save(transactionManager, entity.NguoiDungNgheNghiepCollection);
						
						deepHandles.Add(
							(DeepSaveHandle< NguoiDungNgheNghiep >) DataRepository.NguoiDungNgheNghiepProvider.DeepSave,
							new object[] { transactionManager, entity.NguoiDungNgheNghiepCollection, deepSaveType, childTypes, innerList }
						);
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region NguoiDungChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>Indeco.G24.Entities.NguoiDung</c>
	///</summary>
	public enum NguoiDungChildEntityTypes
	{

		///<summary>
		/// Collection of <c>NguoiDung</c> as ManyToMany for DiaBanCollection_From_NguoiDungDiaBan
		///</summary>
		[ChildEntityType(typeof(TList<DiaBan>))]
		DiaBanCollection_From_NguoiDungDiaBan,

		///<summary>
		/// Collection of <c>NguoiDung</c> as ManyToMany for NgheNghiepCollection_From_NguoiDungNgheNghiep
		///</summary>
		[ChildEntityType(typeof(TList<NgheNghiep>))]
		NgheNghiepCollection_From_NguoiDungNgheNghiep,

		///<summary>
		/// Collection of <c>NguoiDung</c> as OneToMany for NguoiDungVaiTroCollection
		///</summary>
		[ChildEntityType(typeof(TList<NguoiDungVaiTro>))]
		NguoiDungVaiTroCollection,

		///<summary>
		/// Collection of <c>NguoiDung</c> as OneToMany for NguoiDungDiaBanCollection
		///</summary>
		[ChildEntityType(typeof(TList<NguoiDungDiaBan>))]
		NguoiDungDiaBanCollection,

		///<summary>
		/// Collection of <c>NguoiDung</c> as OneToMany for NguoiDungNhaCungCapCollection
		///</summary>
		[ChildEntityType(typeof(TList<NguoiDungNhaCungCap>))]
		NguoiDungNhaCungCapCollection,

		///<summary>
		/// Collection of <c>NguoiDung</c> as OneToMany for QuanLyFileCollection
		///</summary>
		[ChildEntityType(typeof(TList<QuanLyFile>))]
		QuanLyFileCollection,

		///<summary>
		/// Collection of <c>NguoiDung</c> as OneToMany for NguoiDungNgheNghiepCollection
		///</summary>
		[ChildEntityType(typeof(TList<NguoiDungNgheNghiep>))]
		NguoiDungNgheNghiepCollection,

		///<summary>
		/// Collection of <c>NguoiDung</c> as ManyToMany for VaiTroCollection_From_NguoiDungVaiTro
		///</summary>
		[ChildEntityType(typeof(TList<VaiTro>))]
		VaiTroCollection_From_NguoiDungVaiTro,

		///<summary>
		/// Collection of <c>NguoiDung</c> as ManyToMany for NhaCungCapCollection_From_NguoiDungNhaCungCap
		///</summary>
		[ChildEntityType(typeof(TList<NhaCungCap>))]
		NhaCungCapCollection_From_NguoiDungNhaCungCap,
	}
	
	#endregion NguoiDungChildEntityTypes
	
	#region NguoiDungFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;NguoiDungColumn&gt;"/> class
	/// that is used exclusively with a <see cref="NguoiDung"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class NguoiDungFilterBuilder : SqlFilterBuilder<NguoiDungColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the NguoiDungFilterBuilder class.
		/// </summary>
		public NguoiDungFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the NguoiDungFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public NguoiDungFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the NguoiDungFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public NguoiDungFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion NguoiDungFilterBuilder
	
	#region NguoiDungParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;NguoiDungColumn&gt;"/> class
	/// that is used exclusively with a <see cref="NguoiDung"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class NguoiDungParameterBuilder : ParameterizedSqlFilterBuilder<NguoiDungColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the NguoiDungParameterBuilder class.
		/// </summary>
		public NguoiDungParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the NguoiDungParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public NguoiDungParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the NguoiDungParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public NguoiDungParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion NguoiDungParameterBuilder
} // end namespace
